package com.abacus.pay.dao;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
	private final static SessionFactory sessionFactory;
	static {
		Configuration cfg = new Configuration().configure("/hibernate.cfg.xml");
		sessionFactory = cfg.buildSessionFactory();
	}

	public static Session getCurrentSession() {
		return sessionFactory.getCurrentSession();
	}

	public static void close() {
		if (null != sessionFactory) {
			sessionFactory.close();
		}
	}
}
